<template>
	<view>
		<view class="menu">
			<view class="menu-item" v-for="menu in menuList" @click="menuClick(menu)">
				<view>{{menu.text}}</view>
				<image src="@/static/icon/arrow.png" class="arrow"/>
			</view>
		</view>

		<!--消息提示-->
		<u-notify ref="notify"></u-notify>
	</view>
</template>

<script>
export default {
	name: "setting",
	data() {
		return {
			// 菜单列表
			menuList: [{
				text: '修改登录密码',
				path: '/pages/setting/menu/update_password'
			}, {
				text: '导入',
				path: '/pages/setting/menu/import'
			}, {
				text: '导出',
				path: '/pages/setting/menu/export'
			}, {
				text: '关于',
				path: '/pages/setting/menu/about'
			}]
		};
	},
	created() {
		uni.$on('settingSuccess', message => this.$refs.notify.success(message));
	},
	methods: {
		/**
		 * 菜单点击事件
		 *
		 * @param menu 菜单
		 */
		menuClick(menu) {
			uni.navigateTo({
				url: menu.path
			});
		}
	}
}
</script>

<style scoped>
.menu {
	padding: 0 15px;
}
.menu-item {
	display: flex;
	justify-content: space-between;
	height: 40px;
	align-items: center;
	border-bottom: 1px solid #eeeeee;
	padding: 0 10px 0 5px;
}
/*菜单右侧小箭头*/
.arrow {
	width: 10px;
	height: 15px;
}
</style>
